<!--<?php
if(!$action){
print <<<EOT
-->
<script language="javascript">
var path = '$very[url]/$very[attachdir]';
var _img = null;

function showpic(filepath){
	var preview = document.getElementById('preview');
	document.getElementById('picture').innerHTML="正在加载图片，请稍侯...";
	_img = new Image();
	_img.src = path+"/"+filepath;
	preview.style.display='';
	checkLoadFinished(1);			
}

function hidePreview(){
	document.getElementById('preview').style.display='none';
}

function checkLoadFinished(count) {
	if (count > 1000) { document.getElementById('picture').innerHTML = '发生错误，加载图片超时'; return; }
	var state = '';
	if (document.all) state = _img.readyState;
	else state = _img.complete ? 'complete' : '';
	if(state!='complete') { window.setTimeout("checkLoadFinished(" + (count + 1) + ")",50); return; }
	var MaxW = 300; var MaxH = 200;
    var dW=_img.width; var dH=_img.height;
    if(dW>MaxW || dH>MaxH) {  a=dW/MaxW; b=dH/MaxH;if(b>a){ a=b; } dW=dW/a; dH=dH/a; }
    if(dW > 0 && dH > 0) { _img.width=dW; _img.height=dH; }

	var picture = document.getElementById("picture");
	var childs = picture.childNodes; for (var i = 0; i < childs.length; ++i) picture.removeChild(childs[i]);
	_img.style.border="#E3E3E3 5px solid";
	picture.appendChild(_img);
	document.getElementById('loading').style.display="none";
}
</script>
<base target="_self">
<div class="m"></div>
<!--<div id="quote" style="background-color:#FFFFFF; position:absolute; right:5px; top:5px; display:none" class="t">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr class="head">
    <td><div style="float:right"><img src="images/admin/close.gif" onClick="hideQuote();" style="cursor:pointer"></div>图片引用情况</td>
  </tr>
  <tr>
    <td>
	<div id='quoteinfo' style="text-align:center; width:100%">
	</div></td>
  </tr>
</table>
</div>-->
<div id="loading" style="color:white;background-color:blue;position:absolute;padding:5px;display:none;
	top:250px; left:300px; z-index:90"><label id="DownloadInfo" style="display:block;color:#FFF;">正在加载图片，请稍候...</label></div>
<div id="preview" style="background-color:#FFFFFF; position:absolute; right:5px; top:5px; display:none; width:100px;" class="t">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr class="head">
    <td><div style="float:right"><img src="images/admin/close.gif" onClick="hidePreview();" style="cursor:pointer"></div>图片预览区域</td>
  </tr>
  <tr>
    <td>
	<div id='picture' style="padding:10px;text-align:center; width:100%">
	</div></td>
  </tr>
</table>
</div>
<form action="$basename" method="post" name="file">
<div class="t">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr class="head">
    <td colspan="7">附件资源管理 (此处附件显示无法做到完全准确，只能作为参考) </td>
    </tr>
  <tr class="tr2">
    <td width="5%">&nbsp;</td>
    <td>原始文件名</td>
    <td>描述</td>
    <td>文件保存路径</td>
    <td>文件大小</td>
    <td>上传时间</td>
    <td>管理</td>
  </tr>
<!--
EOT;
foreach($files as $file){
print <<<EOT
-->
  <tr class="tr3">
    <td><input name="aid[]" type="checkbox" id="del[]" value="$file[aid]" $file[disable] /></td>
    <td><img src="$file[icon]" width="16" height="16" hspace="5" align="absmiddle" /><a href="$file[url]">$file[filename] </a></td>
    <td>$file[fileintro]&nbsp;</td>
    <td>$file[filepath]</td>
    <td>$file[filesize]</td>
    <td>$file[uploadtime]<br /></td>
    <td>
<!--
EOT;
if($file[tid]){
print <<<EOT
-->
	<a href="javascript:void(0);" onclick="return viewQuote('$file[aid]');"><img src="images/admin/quote.png" align="absmiddle" alt="查看引用" /></a>
<!--
EOT;
}else{
print <<<EOT
-->
	<a href="$basename&action=del&aid=$file[aid]"><img src="images/admin/delete.png" align="absmiddle" alt="删除" onClick="return confirm('您确定要删除此附件？');"/></a>
<!--
EOT;
}print <<<EOT
-->	</td>
  </tr>
<!--
EOT;
}print <<<EOT
-->
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</div>
<div class="pages">$pages</div>
<div class="sub">
  <input name="path" type="hidden" id="path" value="$path" />
  <input name="action" type="hidden" id="action" value="del" />
  <input type="button" name="Submit2" value="全选" class="btn" onclick="CheckAll(document.file);" />
  <input type="submit" name="Submit" value="删除" onClick="return confirm('您确定要删除选中的附件？');" class="btn" />
</div>
</form>
<script language="javascript" src="script/xhr.js"></script>
<script language="javascript">
function viewQuote(aid){
	var x = new XHR('showQuote');
	x.get("$basename&action=viewquote&aid="+aid);
	return false;
}

function showQuote(res){
	document.getElementById('quote').style.display = '';
	document.getElementById('quoteinfo').innerHTML = res;
}

function hideQuote(){
	document.getElementById('quote').style.display = 'none';
}
</script>
<!--
EOT;
}elseif($action=='viewquote'){
print <<<EOT
-->
<table width="100%" cellpadding="0" cellspacing="0">
<!--
EOT;
foreach($q as $v){
print <<<EOT
-->
<tr class="tr">
  <td>所属{$very[contentName]}模型</td>
  <td>目录</td>
  <td>标题</td>
</tr>
<tr class="tr3">
  <td>$v[mname]</td>
  <td>$v[cname]</td>
  <td>$v[title]</td>
</tr>
<!--
EOT;
}print <<<EOT
-->
</table>
<!--
EOT;
}
?>-->